<template>
  <div class="main">
    <div class="head flex">
      <div class="left">
        <h1 class="font-28">店铺管理</h1>
        <p class="font-16">授权独立站店销，打通带货红人视频数据和商品成交数据，更精细化评估ROI。</p>
      </div>
      <div class="right">
        <el-steps :active="5" :align-center="true">
          <el-step title="授权独立站店铺" />
          <el-step title="添加需分销的商品" />
          <el-step title="创建分销计划" />
          <el-step title="邀请红人参与分销" />
          <el-step title="查看红人渠道带来的订单数据" />
        </el-steps>
      </div>
    </div>

    <div class="data">
      <div v-for="(item, index) in dataList" :key="index" class="item">
        <p class="item-name font-16">{{ item.name }}</p>
        <div class="item-bottom flex flex-align-items-center">
          <p class="font-30-B">{{ item.num || '-' }}</p>
          <i class="iconfont icon-bar-chart" :style="{ color: item.color }"></i>
        </div>
      </div>
    </div>

    <div class="wrap">
      <div class="btns flex">
        <p class="font-14 pointer" @click="associationShopShow = true">关联Shopify店铺</p>
      </div>
      <el-table :data="tableData" style="width: 100%;" class="table">
        <el-table-column prop="value" label="关联时间" width="120" />
        <el-table-column prop="value" label="独立站平台" width="100" />
        <el-table-column prop="value" label="ID" width="120" />
        <el-table-column prop="value" label="店铺名称" width="110" />
        <el-table-column prop="value" label="域名" width="170" />
        <el-table-column prop="value" label="关联状态" width="100" />
        <el-table-column prop="value" label="同步时间" />
        <el-table-column label="操作" fixed="right" width="124">
          <template #default="scope">
            <div class="row-btns flex flex-align-items-center">
              <p class="row-btn font-14 pointer" @click="toDetail(scope.row)">详情</p>
              <span class="line"></span>
              <p class="row-btn font-14 pointer" @click="toEdit(scope.row)">编辑</p>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination flex flex-align-items-center">
        <el-pagination layout="prev, pager, next, total" :total="form.total" />
      </div>
    </div>
  </div>

  <association-shop v-if="associationShopShow" @close="associationShopShow = false"></association-shop>
</template>

<script setup>
import AssociationShop from './components/associationShop.vue'
import { ref, onMounted } from 'vue';
import api from '@/api/index.js';

const associationShopShow = ref(false);
const dataList = ref([
  {
    name: '授权店铺数量',
    num: 0,
    color: '#34c962'
  },
  {
    name: '分销商品数量',
    num: 0,
    color: '#ff5277'
  },
  {
    name: '分销合作红人数',
    num: 0,
    color: '#c934be'
  },
  {
    name: '分销订单数',
    num: 0,
    color: '#efcd3d'
  },
  {
    name: '分销销售额',
    num: 0,
    color: '#c934be'
  },
  {
    name: '分销佣金',
    num: 0,
    color: '#ff5277'
  }
]);
const form = ref({
  total: 1
});
const tableData = ref([]);
</script>

<style lang="less" scoped>
.main {
  padding: 16px;
}

.head {
  height: 150px;
  padding: 24px;
  background-image: url(@/assets/bg-task.png);
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 2px;
  margin-bottom: 24px;
  position: relative;

  .left {
    width: 40%;

    h1 {
      color: rgba(51, 51, 51, .85);
      margin-bottom: 12px;
      line-height: 40px;
    }

    p {
      color: hsla(0, 0%, 40%, .85);
      line-height: 22px;
    }
  }

  .right {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 50%;
  }
}

.data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;

  .item {
    height: 131px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .04);

    .item-name {
      border-bottom: 1px solid #f6f8f9;
      color: rgba(51, 51, 51, .65);
      line-height: 48px;
      padding: 0 24px;
    }

    .item-bottom {
      height: 82px;
      padding: 0 24px;

      p {
        color: #333;
        margin-right: 16px;
      }

      i {
        font-size: 24px;
      }
    }
  }
}

.wrap {
  padding: 16px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);

  .btns {
    margin-bottom: 16px;

    p {
      min-width: 70px;
      padding: 0 8px;
      height: 32px;
      border-radius: 2px;
      background: @main-color !important;
      color: #fff;
      line-height: 32px;
    }
  }

  .table {
    &::v-deep {
      .el-table__empty-block {
        height: 500px !important;
      }
    }
  }


  .pagination {
    justify-content: end;
    margin-top: 16px;
  }
}
</style>
